package com.game.server.message.proto.execute;

import java.util.Collection;

import com.comm.ISession;

import com.game.majiang.logic.LogicClient;
import com.game.majiang.logic.LogicServer;
import com.game.majiang.logic.chexuan.ChexuanTabale;
import com.game.server.message.proto.in.AbstractGetControlBringInDataReq;
import com.game.server.message.proto.out.ControlBringInStruct;
import com.game.server.message.proto.out.GetControlBringInDataRsp;
import com.game.server.system.AbstractTable;

public class GetControlBringInDataReq extends AbstractGetControlBringInDataReq {

    @Override
    public void Execute(ISession session) {
        LogicClient client = (LogicClient) LogicServer.getInstance().getClient(session.getId());
        if (client != null&&client.checkClick(msgcode)) {
           AbstractTable abTable = client.getTable();
           if(abTable != null) {
        	   ChexuanTabale table = (ChexuanTabale) abTable;
        	   GetControlBringInDataRsp grsp = new GetControlBringInDataRsp();
				Collection<ControlBringInStruct> values = table.getMapCBI().values();
				grsp.setCbi(values.toArray(new ControlBringInStruct[values.size()]));
				client.Send(grsp);
           }
        }
    }

}
